class Solution
{
public:
    int minimumLines(vector<vector<int>> &stockPrices)
    {
        if (stockPrices.size() == 1)
        {
            return 0;
        }
        int lineCount = 1;
        int n = stockPrices.size();
        sort(stockPrices.begin(), stockPrices.end());
        for (int i = 2; i < n; ++i)
        {
            long long dx1 = stockPrices[i - 1][0] - stockPrices[i - 2][0];
            long long dx2 = stockPrices[i][0] - stockPrices[i - 2][0];
            long long dy1 = stockPrices[i - 1][1] - stockPrices[i - 2][1];
            long long dy2 = stockPrices[i][1] - stockPrices[i - 2][1];
            if (dx1 * dy2 != dx2 * dy1)
            {
                ++lineCount;
            }
        }
        return lineCount;
    }
};